// C1 E19

#include <stdio.h>

#define MAXLINE 1000

int getstr(char s[], int lim);
void reversestr(char source[], int len);

int main()
{
    int len;
    char s[MAXLINE];

    len = 0;

    while ((len = getstr(s, MAXLINE)) > 0)
    {
        reversestr(s, len);
    }

    return 0;
}

void reversestr(char s[], int len)
{
    int i;
    int c;
    int leng;

    i = 0;
    leng = len;

    if (s[len - 1] == '\n')
        leng--;

    while (i < (leng / 2)) //WARNING! Not (i < leng).
        c = s[i],
        s[i] = s[leng - 1 - i],
        s[leng - 1 - i] = c,
        i++;

    printf(">>>Length = %d  \tReverse times = %d\n>>>%s\n", len, i, s);

    return;
}

int getstr(char s[], int lim)
{
    int c;
    int i;

    i = 0;
    lim = MAXLINE;

    while (i < lim - 1 && (c = getchar()) != EOF && c != '\n')
    {
        s[i] = c;
        i++;
    }
    if (c == '\n')
        s[i] = '\n',
        i++;
    s[i] = '\0';

    return i;
}